from abc import ABC
from datetime import datetime

from ctaf_core.ctaf_utils.string_process_util import generate_uuid


class BaseServiceReq(ABC):

    def __init__(self, ctaf_service_name: str, ctaf_trace_id: str = None):
        self.__ctaf_service_name: str = ctaf_service_name
        if ctaf_trace_id:
            self.__ctaf_trace_id: str = ctaf_trace_id
        else:
            self.__ctaf_trace_id: str = generate_uuid()
        self.__request_timestamp: datetime = datetime.now()

    def get_called_service_name(self)->str:
        return self.__ctaf_service_name

    def get_ctaf_trace_id(self)->str:
        return self.__ctaf_trace_id

    def get_request_timestamp(self)->datetime:
        return self.__request_timestamp